﻿using System;
using System.Threading.Tasks;

namespace Chapter1_17
{
    public static class Program
    {
        public static void Main(string[] args)
        {
            ParallelLoopResult result = Parallel.For(0, 400, (int i, ParallelLoopState state) => {
                if (i == 200)
                {
                    Console.WriteLine("Break");
                    state.Break();
                }
                else
                {
                    System.Threading.Thread.Sleep(1000); 
                    Console.WriteLine(i);
                }
                return; 
            });

            Console.ReadLine(); 

        }
    }
}
